import { TargetTypeEnum, IBaseTableRequestParams, IBaseTableResonseExtraData } from 'src/interface';

export interface IMenuTreeRequestParams {
  parentId?: string;
  menuName?: string;
  menuType?: number;
}

export interface IMenuRespData {
  menuId: string;
  parentId?: string;
  weight?: number;
  name?: string;
  path?: string;
  locale?: string;
  meta?: {
    isLink?: boolean;
    title?: string;
    icon?: string;
    cache?: boolean;
    visible?: boolean;
    target?: TargetTypeEnum;
  };
  children?: IMenuRespData[];
}

export interface IMenuRespFlatData {
  menuId: string;
  parentId?: string;
  weight?: number;
  name?: string;
  path?: string;
  isLink?: boolean;
  title?: string;
  icon?: string;
  cache?: boolean;
  visible?: boolean;
  target?: TargetTypeEnum;
  locale?: string;
  children?: IMenuRespData[];
}

export interface IMenuHandleRequestData {
  menuId?: string;
  name: string;
  premission?: string;
  parentId: string;
  icon?: string;
  path: string;
  visible?: string;
  menuType: string;
  cache?: string;
  flatMenu?: number;
  locale?: string;
  target?: string;
  sortOrder?: number;
}

export type IMenuHandleRespData = IMenuHandleRequestData & IBaseTableResonseExtraData;

export interface IRoleRequestParams extends IBaseTableRequestParams {
  roleName?: string;
}

export interface IRoleRespData extends IBaseTableResonseExtraData {
  roleId: string;
  roleName: string;
  roleCode: string;
  roleDesc: string;
  dsType: number;
  dsScope: string;
  sysRoleMenus: Array<{ roleId: string; menuId: string }>;
}

export type IRoleActionRequestData = Exclude<IRoleRespData, 'roleId'> & { roleId?: string };

export interface IDeptRequestParam {
  deptName?: string;
  parentId?: string;
}

export interface IDeptRespData {
  deptId: string;
  deptName: string;
  parentId: string;
  sortOrder: number;
  children?: IDeptRespData[];
}

export interface IDeptActionRequestData {
  deptId?: string;
  deptName: string;
  parentId: string;
  sortOrder: number;
}
